package Dao


func Getallorders() (error, []Orders, int64) {
	var orderdate []Orders
	var total int64
	err := Db.Table("orders").Count(&total).Order("order_id").Find(&orderdate).Error
	return err, orderdate, total
}

func Addorder(order Orders) error{
	err := Db.Table("orders").Select("order_id","consumer_id","goods_id","order_date","order_request","order_is_availabe","order_freight").Create(&order).Error
	return err
}

func Updateorder(order Orders) error{
	err := Db.Table("orders").Where("order_id = ?", order.Order_id).Updates(&order).Error
	return err
}

func Deleteorder(id string) error {
	var order []Orders
	err := Db.Table("orders").Where("order_id = ?", id).Delete(&order).Error
	return err
}
